import { expect, test } from "@playwright/test";

test("should test if poweredByHeader adds the correct headers ", async ({ page }) => {
	const result = await page.goto("/");
	expect(result).toBeDefined();
	expect(result?.status()).toBe(200);
	const headers = result?.headers();

	// Both these headers should be present cause poweredByHeader is true in pagesRouter
	expect(headers?.["x-powered-by"]).toBe("Next.js");
	expect(headers?.["x-opennext"]).toBe("1");
	// This header should be defined cause we have set the `OPEN_NEXT_REQUEST_ID_HEADER` env variable in wrangler.jsonc
	expect(headers?.["x-opennext-requestid"]).not.toBeUndefined();
});
